package com.goktech.sportsmall.controller;


import com.goktech.sportsmall.bean.CommodityBean;
import com.goktech.sportsmall.service.CommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class CommodityContoller {

    @Autowired(required = false)
    private CommodityService commodityService;

    @RequestMapping("addCommodity")
    public String addCommodity(CommodityBean commodityBean){
        return commodityService.addCommodity(commodityBean);
    }


    @RequestMapping("selectList")
    public List<CommodityBean> selectList(CommodityBean commodityBean){
        return commodityService.selectList(commodityBean);
    }

    // 分页查询
    @RequestMapping("limitSelect")
    public Map<String,Object> limitSelect(int page,int size){
        return commodityService.limitSelect(page,size);
    }

    // 删除信息
    @RequestMapping("deleteCommodity")
    public String deleteCommodity(String no){
        return commodityService.deleteCommodity(no);
    }

    // 更新信息
    @RequestMapping("updateCommodity")
    public String updateCommodity(CommodityBean commodityBean) {
        return commodityService.updateCommodity(commodityBean);
    }

    @RequestMapping("queryLimitSelect")
    public Map<String, Object> queryLimitSelect(String c_name, String c_sort, String c_detail, int page, int size) {
        return commodityService.queryLimitSelect(c_name,c_sort,c_detail,page,size);
    }
}
